package com.gitee.wsl.unit.system

import com.gitee.wsl.unit.BaseUnit
import com.gitee.wsl.unit.UnitType

sealed interface SystemUnitType: UnitType<Long> {
    val prefix: String

    data object DECIMAL: SystemUnitType {
        override val prefix: String = ""
        override val baseUnit: Long = 10
    }

    data object BINARY: SystemUnitType {
        override val prefix: String = "0b"
        override val baseUnit: Long = 2
    }

    data object OCTAL: SystemUnitType {
        override val prefix: String = "0o"
        override val baseUnit: Long = 8
    }

    data object HEX: SystemUnitType {
        override val prefix: String = "0x"
        override val baseUnit: Long = 16
    }
}


sealed class SystemUnit(value:Long, type: SystemUnitType): BaseUnit<Long, SystemUnitType>(value, type) {

    override fun toBase(): Long {
        return value
    }
}